package com.kdtech.analyse.news;
import com.kdtech.analyse.AnalyseNews;
import com.kdtech.utils.HtmlCleaner;


import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import com.kdtech.utils.HtmlCleaner;
import com.kdtech.analyse.JSoupUtils;
import com.kdtech.analyse.common.AnalyseSelector;
import com.kdtech.analyse.common.NewsAnalyseConfig;
import com.kdtech.crawler.CrawlHTML;
import com.kdtech.entity.crawler.UrlMeta;
import com.kdtech.entity.data.NewsMeta;
import com.kdtech.utils.RegexUtils;

/**
 *
 * @author KK
 *
 */
public class YcwbNewsAnalyse implements AnalyseNews {

	private static final String[] regex={
		"http://.*.ycwb.com/[0-9]{4}-[0-9]{2}/[0-9]{2}/content_[0-9]+.htm",
		"http://baoliao.ycwb.com/index.php\\?pfile=1&act=view&id=[0-9]*"
	};

	
	public boolean isDetailPage(String url) {
		return RegexUtils.matchAnyIgnoreCase(url, regex);
	}

	
	public NewsMeta parserHtml(UrlMeta urlMeta) {
		return null;
	}
	public static void main(String[] args) {
		String url="http://news.ycwb.com/2014-02/11/content_6054021.htm";
		YcwbNewsAnalyse analyse=new YcwbNewsAnalyse();
		System.out.println(analyse.isDetailPage(url));
		UrlMeta meta=CrawlHTML.responseToURL(url);
		System.out.println(analyse.parserHtml(meta));
	}

	
	public NewsMeta Update(NewsMeta meta) {
		return null;
	}

	
	public boolean isNeedUpdate(){
		return false;
	}
}

